<template>
  <div class="search-com">
    <el-input
      placeholder="请输入内容"
      v-model="searchText"
      class="search-com__input"
    >
      <el-select
        v-model="searchType"
        slot="prepend"
        class="search-com__input-select"
        placeholder="请选择"
      >
        <el-option
          v-for="dict in dict.type.know_search"
          :key="dict.value"
          :label="dict.label"
          :value="dict.value"
        />
      </el-select>
      <el-button
        slot="append"
        class="search-com__input-btn"
        icon="el-icon-search"
      ></el-button>
    </el-input>
    <div class="search-com__keywords">
      <el-checkbox-group v-model="checkedTypes" @change="handleCheckTypes">
        <el-checkbox
          v-for="typeItem in knowTypes"
          :label="typeItem.label"
          :key="typeItem.value"
          >{{ typeItem.label }}</el-checkbox
        >
      </el-checkbox-group>
    </div>
  </div>
</template>

<script>
import { LS_KNOW_TYPES } from "./data";
export default {
  name: "",
  dicts: ["know_search"],
  data() {
    return {
      // 搜索内容
      searchText: "",
      // 搜索类型， 字典【know_search】
      searchType: "",
      // 所选分类
      checkedTypes: [],
      // 知识分类
      knowTypes: [],
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this.initSearch();
      this.getKnowTypes();
    },
    // 获取知识分类
    getKnowTypes() {
      this.knowTypes = LS_KNOW_TYPES;
    },
    // 初始化搜索条件
    initSearch() {
      this.searchType = this.dict.type.know_search[0]?.value;
    },
    handleCheckTypes() {},
  },
};
</script>

<style lang="scss" scoped>
.search-com {
  width: 100%;
  background-image: url("../../../assets/images/repository/search-banner.jpg");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 20px;
  &__input {
    margin-bottom: 20px;
  }

}
</style>
